﻿#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;

void slove()
{
    ll n;
    cin >> n;
    if (n == 1)
    {
        cout << 1 << endl << 1 << endl;
        return;
    }
    vector<ll> arr;
    int k = 0;
    for (int i = 0; i < 63; i++)
    {
        if (((n >> i) | 1) == 1) k++;
    }
    cout << k << endl;
    for (int i = 0; i < k; i++)
    {

    }
    cout << endl;
}

int main()
{
    std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
    ll n, t;
    cin >> t;
    while (t--)
    {
        slove();
    }
    return 0;
}